package org.ch02.test00.demo04;

import java.lang.reflect.Method;
import java.util.Scanner;

/**
 * 判断是否为闰年
 * @author CSY
 * @date 2025 - 03 - 19
 */
public class MainTest {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Class<?> clazz = sc.getClass();
        Method method = clazz.getMethod("nextInt");
        Object year = method.invoke(sc);
        if(year instanceof Integer){
            Integer y = (Integer)year;
            if (y % 400 ==0 || (y%4==0 && y%100!=0)){
                System.out.println("闰年");
            }else{
                System.out.println("平年");
            }
        }else{
            System.out.println("输入的年份不规范！");
        }


    }
}
